package com.zzz.servlet;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/*
 * @author zzr
 * @date: 2025/07/06  11:55
 * @description: 域对象测试
 */
@WebServlet("/servlet7")
public class servlet7 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServletContext servletContext = getServletContext();
        // 从域对象中读取数据
        String kA = (String) servletContext.getAttribute("kA");
        System.out.println(kA);
    }
}
